package com.modi.breaks; 
  
 import java.awt.Dimension; 
import java.awt.Label;
 import java.awt.Toolkit; 
 import java.awt.event.ActionEvent; 
 import java.awt.event.ActionListener; 
  
 import javax.swing.JButton; 
 import javax.swing.JFrame; 
import javax.swing.JPanel; 
  
 public class StrecthFrame extends JFrame { 
  
         /** 
          *  
          */ 
         private static final long serialVersionUID = 1L; 
         public static final StrecthFrame INSTANCE = new StrecthFrame(); 
         public static JPanel strecthFramePanel = new JPanel(); 
         public static Label label = new Label();
  
         private StrecthFrame() { 
                 setSize(700, 700); 
                 setVisible(false); 
                 
                 StrecthFrame.strecthFramePanel = new JPanel(); 
                 StrecthFrame.label = new Label();
  
                 setTitle("Do your stretches immediately!"); 
                 setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); 
  
                 Toolkit toolkit = getToolkit(); 
                 Dimension size = toolkit.getScreenSize(); 
                 setLocation(size.width / 2 - getWidth() / 2, size.height / 2 
                                 - getHeight() / 2); 
  
                 getContentPane().add(strecthFramePanel); 
                 strecthFramePanel.add(label);
  
                 JButton close = new JButton( 
                                 "Completed the strecthes. Thanks for reminding me."); 
                 
                 close.addActionListener(new ActionListener() { 
                         public void actionPerformed(ActionEvent event) { 
                                 System.out 
                                                 .println("Record the end time of srecth and close the frame"+DateUtils.now()); 
                                 StrecthFrame.label.setText("End time-----"+DateUtils.now());  
                                 Main.breakTime.add(DateUtils.now());
                                 (new StretchScheduler()).startTheScheduler(); 
                                 StrecthFrame.INSTANCE.setVisible(false);
                                 
                                 
  
                         } 
                 }); 
                 close.setBounds(50, 60, 80, 30); 
                 strecthFramePanel.add(close); 
  
         } 
  
          
  
        
  
 } 
 